<include file="Public:html:inHeader" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="__JS__/validfrom/css/style.css" type="text/css" media="all" />
<link href="__JS__/validfrom/css/demo.css" type="text/css" rel="stylesheet" />

<link href="__JS__/validfrom/plugin/jqtransform/jqtransform.css" type="text/css" rel="stylesheet" />


<script type="text/javascript" src="__JS__/validfrom/js/Validform_v5.2_min.js"></script>

<script type="text/javascript" src="__JS__/validfrom/plugin/jqtransform/jquery.jqtransform-min.js"></script>
<script type="text/javascript" src="__JS__/validfrom/plugin/swfupload/swfuploadv2.2-min.js"></script>
<script type="text/javascript" src="__JS__/validfrom/plugin/swfupload/Validform.swfupload.handler.js"></script>
<link href="__CSS__/table.css" rel="stylesheet" type="text/css" />
<script src="__JS__/popup/popup.js"></script>
<script src="__JS__/popup/user.js"></script>
<title>{$title|default=''}</title>
<script>
	$(document).ready(function(){
		
		$(".registerform").Validform({
			tiptype:function(msg,o,cssctl){
				if(!o.obj.is("form")){
					var objtip=o.obj.parents("td").next().find(".Validform_checktip");
					cssctl(objtip,o.type);
					objtip.text(msg);
				}

			},
			usePlugin:{
				swfupload:{
					file_post_name: "resume_file",
					upload_url: "?g=Home&m=Order&a=upload&o_id={$o_id}",
					button_image_url: "__JS__/validfrom/plugin/swfupload/XPButtonUploadText_61x22-cn.png",
					//button_image_url: "__PUBLIC__/images/home/upload-3.png",
					flash_url: "__JS__/validfrom/plugin/swfupload/swfupload.swf",
					file_size_limit:"{$filesize}",
					file_types:"{$extName}"
				}/*,
				jqtransform:{}*/
			},
			ajaxPost:true,
			callback:function(data){
				alert(data.info);
				if(data.status=="y"){
					parent.window.location.reload();
					//window.location.href="?g=Admin&m=Order&a=viewdetail&O_ID="+data.O_ID;
					/*setTimeout(function(){
						$.Hidemsg(); //公用方法关闭信息提示框;显示方法是$.Showmsg("message goes here.");
					},2000);
					*/
				}
			}
		});
		//得到地区
		$("#AR_L1").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$("#AR_L2").empty();
			$("#AR_L2").append('<option value="">--市辖区--</option>');
			getArea('AR_L1',$(this).val(),'AR_L2');
		});
		$("#AR_L2").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$('#AR_L3').empty();
			$('#AR_L3').append('<option value="">--区县--</option>');
			getArea('AR_L1|AR_L2',$("#AR_L1").val()+"|"+$(this).val(),'AR_L3');
		});
		
		$("#sCr").bind("click",function(){
			var url="?g=Admin&m=User&a=cslist&t=c&f1=CU_ID&f2=CU_NAME";
			pDialog('',url,500,380);
		});
		$("#P_CHANNEL_ID").bind('change',function(){
			if($(this).val()>0){
				var txt=$(this).find("option:selected").text();  
				$("#P_CHANNEL").val(txt);
			}else{
				$("#P_CHANNEL").val('');
			}
			
		});
		$("#P_BRAND").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$("#P_CATEGORY").empty();
			$("#P_CATEGORY").append('<option value="">--产品类型--</option>');
			getProduct('P_BRAND',$(this).val(),'P_CATEGORY');
		});
		$("#P_CATEGORY").bind('change',function(){
			if($(this).val()==''){
				return false;
			}
			$('#P_MODEL').empty();
			$('#P_MODEL').append('<option value="">--产品型号--</option>');
			getProduct('P_BRAND|P_CATEGORY',$("#P_BRAND").val()+"|"+$(this).val(),'P_MODEL');
		});
		function getProduct(stName,st,fl){
			$.ajax({
				   type: "POST",
				   url: "?g=Admin&m=Index&a=getProduct",
				   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
				   dataType:'json',
				   success: function(msg){
					 if(msg.sucess=='y'){
						var f=msg.fl;
						var data=msg.data;
						var _html=[];
						var k;
						for (k in data){
							_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
						}
						$("#"+f).append(_html.join(''));
					 }
				     
				   }
			});
		}
	});
	
	function getArea(stName,st,fl){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getArea",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						_html.push('<option value="'+data[k]+'">'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
					
					for (k in data){
						_html.push('<li><a href="javascript:;">'+data[k]+'</a></li>');
					}
					$("#"+f+"_1").append(_html.join(''));
				 }
			     
			   }
		});
	}

	function setArea(stName,st,fl,v){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getArea",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					for (k in data){
						var _sel='';
						if(v==data[k]){
							_sel="selected";
						}
						_html.push('<option value="'+data[k]+'"  '+_sel+'>'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
				 }
			     
			   }
		});
	}
	function setProduct(stName,st,fl,v){
		$.ajax({
			   type: "POST",
			   url: "?g=Admin&m=Index&a=getProduct",
			   data: "stName="+stName+"&st="+st+"&fl="+fl+'&rd'+Math.random(),
			   dataType:'json',
			   success: function(msg){
				 if(msg.sucess=='y'){
					var f=msg.fl;
					var data=msg.data;
					var _html=[];
					var k;
					
					for (k in data){
						var _sel='';
						if(v==data[k]){
							_sel="selected";
						}
						_html.push('<option value="'+data[k]+'" '+_sel+'>'+data[k]+'</option>');
					}
					
					$("#"+f).append(_html.join(''));
				 }
			     
			   }
		});
	}
</script>
<style>
body{background-color:#ffffff}
</style>
</head>
<body >

<div >

	<form action="?g=Admin&m=Order&a=saveEdit" method="post" class="registerform" id="roleForm" enctype="multipart/form-data" >
		<fieldset>
    		<legend>商品信息</legend>
    		
	    		<table>
	    			
		               <tr>
		                 
		                 
		                  <td class="need" style="width:0px;"></td>
		                  <td style="line-height:30px;line-height:30px;"><span class="inputYes">*</span>选择安装方式</td>
		                  <td style="">
		                 	<select size=1 id="O_S_TYPE" name="data[O_S_TYPE]" datatype="*" style="width:120px;height:22px;">
								<volist name="installMode" id="vo">
								<assign name="stypeSelect" value="$vo.id" />
								<option value="{$vo.id}" <if condition="($uData.O_S_TYPE eq $stypeSelect) or ($stypeSelect eq 1)">selected</if>>{$vo.name}</option>
								</volist>
							</select>
		                  </td>
		                  
		              </tr>
		    		 <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:90px;line-height:30px;"><span class="inputYes">*</span>选择产品</td>
		                  <td style="width:;">
		                  <table border="0" cellpacing="0" cellpadding="0" style="padding-left:10px;">
							<tr>
								<td >
									<select   id="P_BRAND" name="data[P_BRAND]" datatype="*"  style="width:120px;height:20px;">
												<option value="">--品牌--</option>
												<volist name="BRAND" id="vo">
												<option value="{$vo}" <if condition="$uData.P_BRAND eq $vo">selected</if>>{$vo}</option>
												</volist>
									</select>
								</td>
							
								<td >
									<select  id="P_CATEGORY" name="data[P_CATEGORY]" datatype="*"  style="width:120px;height:20px;">
												<option value="">--产品类型--</option>
									</select>
								</td>
								<td >
									<select  id="P_MODEL" name="data[P_MODEL]" datatype="*"  style="width:120px;height:20px;">
												<option value="">--产品型号--</option>
									</select>
									<span>
									数量：
									<select size="1"  id="P_COUNT" name="data[P_COUNT]" style="width:50px;">
													    <for start="1" end="20">
														<option value="{$i}" <if condition="$uData.P_COUNT eq $i">selected</if>>{$i}</option>
														</for>
													</select>
									</span>
								</td>
								
								</tr>
								
						</table>
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_AR_L" style="line-height:30px;">请选择产品</div></td>
		              </tr>
		             
					   <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;"><span class="inputYes">*</span>安装卡：</td>
		                  <td style="width:;">
		                 <input style=""  type="text" value="" id="txtFileName" disabled="disabled" autocomplete="off" class="inputxt"  plugin="swfupload" />
					           	<span id="spanButtonPlaceholder" ></span>
					            <input type="hidden" pluginhidden="swfupload" name="data[hidFileID]" id="hidFileID" value="" />
				            
		                  </td>
		                   <td><div class="Validform_checktip" id="azk_show">扫描或拍摄，{$extName}格式，500K以内</div></td>
		              </tr>
		              
		               <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;"><span class="inputYes">*</span>购买渠道</td>
		                  <td style="width:;">
		                  <table border="0" cellpacing="0" cellpadding="0">
									<tr>
										<td>
											<select size="1"   id="P_CHANNEL_ID" name="data[P_CHANNEL_ID]" style="width:120px;height:20px;">
												<option value="">--选择渠道--</option>
												<volist name="channel" id="vo">
												<assign name="channelSelect" value="$vo.id" />
												<option value="{$vo.id}" <if condition="$uData.P_CHANNEL_ID eq $channelSelect">selected</if>>{$vo.name}</option>
												</volist>
											</select>
										</td>
										<td>
										<input type="text" class="inputxt" id="P_CHANNEL" name="data[P_CHANNEL]" value="{$uData.P_CHANNEL|default=''}" datatype="*"  style="width:180px">
										</td>
									</tr>
								</table>
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_O_ADDRESS" style="line-height:30px;">请选择渠道</div></td>
		              </tr>
		              
		              <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;">购买时间</td>
		                  <td style="width:;">
		                  <input class="inputxt"  type="text" id="P_BUY_TIME" name="data[P_BUY_TIME]" value="{$uData.P_BUY_TIME|DateFormat='Y-m-d',###}" readonly>
						  <img onclick="WdatePicker({el:'P_BUY_TIME'})" src="__JS__/wdatepicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_O_ADDRESS" style="line-height:30px;">请输入购买时间</div></td>
		              </tr>
		              <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:80px;line-height:30px;">订单号</td>
		                  <td style="width:;">
		                 <input class="inputxt" type="text" id="SO_ID" name="data[SO_ID]" value="{$uData.SO_ID|default=''}">
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_O_ADDRESS" style="line-height:30px;">请输入订单号</div></td>
		              </tr>
		             
	    		</table>
    	</fieldset>
    	
    	<fieldset>
    		<legend>备注</legend>
    		
	    		<table>
		    		 <tr>
		                  <td class="need" style="width:0px;"></td>
		                  <td style="width:90px;line-height:30px;"></td>
		                  <td style="width:;">
		                 <textarea rows=3 cols=60 id="O_MEMO" name="data[O_MEMO]" style="width:250px">{$uData.O_MEMO|default=''}</textarea>
		                  </td>
		                  <td><div class="Validform_checktip" id="Validform_checktip_AR_L" style="line-height:30px;">备注信息，255个字符</div></td>
		              </tr>
		               
	    		</table>
    	</fieldset>
    	
    	<fieldset class="action">
    	<input type="hidden" name="data[O_ID]" value="{$uData.O_ID}">
    	<input type="hidden" name="O_ID" value="{$o_id}">
    				<input type="submit" name="submit" id="submit" value="保存" />
    	</fieldset>
    	
	</form>
</div>
<if condition="$uData.P_BRAND neq ''">

	<script>
		
		$("#P_CATEGORY").empty();
		$("#P_CATEGORY").append('<option value="">--产品类型--</option>');
		setProduct('P_BRAND','{$uData.P_BRAND}','P_CATEGORY','{$uData.P_CATEGORY}');
		
		$('#P_MODEL').empty();
		$('#P_MODEL').append('<option value="">--产品型号--</option>');
		setProduct('P_BRAND|P_CATEGORY',"{$uData.P_BRAND}|{$uData.P_CATEGORY}",'P_MODEL','{$uData.P_MODEL}');
	</script>

</if>

</body>


<include file="Public:html:inFooter" />